package com.example.personalizededucationsystem.service.recommendation;

/**
 * Deprecated
 */

/*

@Service("aiGenerationStrategy")
public class AIQuestionGenerationStrategy implements RecommendationStrategy {

    private final AnalysisService analysisService;
    private final AIAssistanceService aiAssistanceService;
    private final KnowledgePointRepository knowledgePointRepository;
    private final QuestionRepository questionRepository; // 修改点1：用 QuestionRepository 替换 QuestionBankService

    @Autowired
    public AIQuestionGenerationStrategy(AnalysisService analysisService,
                                        AIAssistanceService aiAssistanceService,
                                        KnowledgePointRepository knowledgePointRepository,
                                        QuestionRepository questionRepository) { // 修改点2：修改构造函数
        this.analysisService = analysisService;
        this.aiAssistanceService = aiAssistanceService;
        this.knowledgePointRepository = knowledgePointRepository;
        this.questionRepository = questionRepository;
    }

*/
/*    @Override
    @Transactional
    public List<Question> recommend(User student, int count) {
        Map<String, Double> masteryMap = analysisService.calculateStudentMastery(student);
        if (masteryMap.isEmpty()) {
            return Collections.emptyList();
        }

        String weakestKpName = masteryMap.entrySet().stream()
                .min(Map.Entry.comparingByValue())
                .map(Map.Entry::getKey)
                .orElse(null);

        if (weakestKpName == null) {
            return Collections.emptyList();
        }

        KnowledgePoint weakestKp = knowledgePointRepository.findByName(weakestKpName).orElse(null);
        if (weakestKp == null) {
            return Collections.emptyList();
        }


        DynamicQuestionResponseDto aiQuestionDto = aiAssistanceService.generateQuestionFromAI(weakestKpName, "数学", "SINGLE_CHOICE", 0.4f);

        if (aiQuestionDto == null) {
            System.err.println("AI出题失败，返回空。");
            return Collections.emptyList();
        }

        Question newQuestion = new Question();
        newQuestion.setContent(aiQuestionDto.content());
        newQuestion.setOptions(aiQuestionDto.options());
        newQuestion.setAnswer(aiQuestionDto.answer());
        newQuestion.setAnalysis(aiQuestionDto.analysis());
        newQuestion.setDifficulty(aiQuestionDto.difficulty());
        newQuestion.setType(Question.QuestionType.SINGLE_CHOICE);
        newQuestion.setStatus(ApprovalStatus.PENDING);
        newQuestion.setCreator(student);
        newQuestion.getKnowledgePoints().add(weakestKp);

        Question savedQuestion = questionRepository.save(newQuestion);

        return Collections.singletonList(savedQuestion);
    }*//*


    @Override
    public String getStrategyName() {
        return "AI_GENERATION";
    }
}*/
